#ifndef __BUS_DATA_H
#define __BUS_DATA_H

#include <stdio.h>
#include <malloc.h>
#include <string.h>

#define Z_TYPEID_INT 1
#define Z_TYPEID_STR 2

typedef unsigned int z_typeid;
extern z_typeid z_typeid_null;

typedef unsigned int z_size;
extern z_size z_size_empty;

typedef struct
{
	z_typeid tid;
	z_size size;
	void *src;
} z_data;

z_data z_data_init(z_typeid t, z_size s);
int z_data_release(z_data d);
z_typeid z_data_typeid_get(z_data *d);
z_typeid z_data_typeid_set(z_data *d, z_typeid t);
z_size z_data_size_get(z_data *d);
z_size z_data_size_set(z_data *d, z_size s);
void *z_data_src_get(z_data *d);
void *z_data_src_set(z_data *d, void *s);
int z_data_retrieve_query_code(z_data *d);
int z_data_assign_query_code(z_data *d, int c);
int z_data_eq(z_data *a, z_data *b);
int z_data_null(z_data *d);

#endif
